<?php
session_start();
require_once "funciones.php";
$empresa=$_SESSION['caweb']['empresa'];

$q=$_POST["q"];
if ($q == "CLI")
{
	?> Cliente: <select name="temp" size="1" onchange="$('#idubicacion').val(this.value)"> <?

        $link_mantis = con_caweb();
        $result ="SELECT nit,name FROM clientes ORDER BY name";
        $result=mysql_query($result,$link_mantis) or die('Error clientes, '.mysql_error());
        echo "<option value='XXX' SELECTED>Seleccionar..</option>";
        while($row = mysql_fetch_array($result))
        {
                ?> <option value="<? echo $row["nit"]; ?>"><? echo substr($row["name"],0,80)." - ".$row["nit"]; ?> </option>  <?
        }
        echo "</select>";
}

if ($q == "TEC" OR $q == "CC")
{
    ?> Tecnico / Empleado: <select name="tmp" size="1" onchange="document.consultainventarios.ubicacion.value=this.value;"> <?
    $link_intranetpccom = con_intranetpccom();
	$result ="SELECT * FROM usuarios WHERE estado='A' AND entrada='$empresa' ORDER BY nombres";
    $result=mysql_query($result,$link_intranetpccom) or die('Error intranetpccom, '.mysql_error());
    echo "<option value='XXX' SELECTED>Seleccionar..</option>";
    while($row = mysql_fetch_array($result))
    {
		echo "<option value='".$row[cedula]."'>".$row[nombres]." ".$row[apellidos]."</option>";
    }
    echo "</select>";
}

?>
